<!DOCTYPE html>
<html>
<head>
    <include file="public/public_css" />
    <link rel="stylesheet" href="__PUBLIC__/static/css/menu.css">
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

    <include file="public/header-min" />
    <!-- Left side column. contains the logo and sidebar -->
    <include file="public/left" />
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                微信管理
                <a href="javascript:void(0);" onclick="add_menu();"><small>添加菜单</small></a>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
                <li class="active">微信管理</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <!-- Small boxes (Stat box) -->
            <div class="row">
                <form id="myForm" class="form-horizontal">
                    <div class="form-group">
                        <label for="input0" class="col-sm-2 control-label">上级菜单</label>
                        <div class="col-sm-10">
                            <select  name="parent_id" class="form-control" id="input0">
                                <option value="0" selected>作为一级菜单</option>
                                <volist name="list" id="vv">
                                    <option value="{$vv.id}" <if condition="$info['parent_id'] == $vv['id']">selected</if> >{$vv._name}</option>
                                </volist>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="input1" class="col-sm-2 control-label">*菜单名称</label>
                        <div class="col-sm-10">
                            <input id="input1" class="form-control" name="name" type="text"  value="{$info.name}"  placeholder="菜单名称">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="input2" class="col-sm-2 control-label">*菜单url</label>
                        <div class="col-sm-10">
                            <input  id="input2" class="form-control" name="value" value="{$info.value}" type="text" placeholder="例如：http://www.baidu.com">
                        </div>
                    </div>
                    <select  id="input3" class="form-control" name="type" >
                        <option value="view" <if condition="$info['type'] == 'view'">selected</if> >链接</option>
                        <option value="click" <if condition="$info['type'] == 'click'">selected</if> >触发关键字</option>
                    </select>
                    <div class="menu_btn">
                        <button  type="submit" class="btn btn-success" >提交</button>
                    </div>
                </form>
            </div>
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
    <include file="public/footer" />

    <!-- Control Sidebar -->

    <!-- /.control-sidebar -->
    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->

<include file="public/public_js" />
<script src="__PUBLIC__/static/js/jquery.form.js"></script>
<script>
    $('#myForm').submit(function () {
        $(this).ajaxSubmit({
            type : 'POST', //GET,POST
            url: '{$Think.WEB_PATH}/Admin/wei_xin/editMenu?id='+{$info['id']} + '&parent_id=' + {$info['parent_id']} ,
            dataType : 'json', //xml,json,script，默认为null
            resetForm : true, //成功提交后，重置表单
            success : function (data) {
                layer.open({
                    type: 1,
                    time: 1000,
                    area: ['200px', '200px'],
                    content: data.msg //服务器返回的消息
                });
                setTimeout(function(){
                    window.location.reload();
                },1200);
            },
            error : function (event, errorText, errorType) { //错误时调用
                alert(errorText + errorType);
            }
        });
        return false;
    });
</script>
</body>
</html>
